package cn.wongshu.student.controller;

import cn.wongshu.student.pojo.Goods;
import cn.wongshu.student.pojo.Message;
import cn.wongshu.student.pojo.Result;
import cn.wongshu.student.pojo.StatusCode;
import cn.wongshu.student.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    //查看全部的商品
    @GetMapping()
    public Result findAll(){
        List<Goods> goodsList = goodsService.findAll();
        return new Result(true, StatusCode.Ok, Message.SELECT_SUCCESS,goodsList);

    }


}
